use klips_edcc_replication, clear
global controls2 p_married p_male i.p_size i.p_edu1 i.p_region



******************************************************************************************************************************
******************************************************** Main Results ********************************************************
******************************************************************************************************************************



******************************************
******* Table 1, columns (5) to (6) ******
******************************************

preserve
keep if year>=2006
** panel A
xi: reg employed treat_post i.year i.p_age $controls2 [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age $controls2 [pw=wp_c] if employed==1, r

** panel B
xi: reg employed treat_post i.year i.p_age [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age [pw=wp_c] if employed==1, r

** panel C
xi: reg employed treat_post i.year i.p_age treat_year $controls2 [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age treat_year $controls2 [pw=wp_c] if employed==1, r

* mean of dep var
table treat [pw=wp_c] if post==0&treat==1, c(mean employed mean p_hours)
restore


** panel D 
preserve
keep if year>=2006
keep if p_age>=55&p_age<=74

xi: reg employed treat_post i.year i.p_age $controls2 [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age $controls2 [pw=wp_c]if employed==1, r

* mean of dep var
table treat [pw=wp_c] if post==0&treat==1, c(mean employed mean p_hours)
restore


** panel E 
preserve
keep if year>=2006
keep if p_age>=64&p_age<=65

xi: reg employed treat_post i.year i.p_age $controls2 [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age $controls2 [pw=wp_c] if employed==1, r

* mean of dep var
table treat [pw=wp_c] if post==0&treat==1, c(mean employed mean p_hours)
restore


** panel F
xi: reg employed treat_post i.year i.p_age $controls2 [pw=wp_c], r
xi: reg p_hours treat_post i.year i.p_age $controls2 [pw=wp_c] if employed==1, r

* mean of dep var
table treat [pw=wp_c] if post==0&treat==1, c(mean employed mean p_hours)



**********************************************************************************************************************************
******************************************************** Appendix Results ********************************************************
**********************************************************************************************************************************

***********************
******* Table A2 ******
***********************

** panel B
table treat [pw=wp_c] if year>=2006 & post==0, c(mean employed mean p_hours)
tab treat if year>=2006 & post==0



************************
******* Figure A2 ******
************************

** panel C
preserve
collapse (mean) employed [pw=wp_c] if year>=2006&year<=2013, by(year treat)
twoway (scatter employed year if treat==1, mc(black) yaxis(1)) (scatter employed year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Probability of employment(65-84)", axis(1)) ytitle("Probability of employment(45-64)", axis(2)) ///
xlabel(2006(1)2013)
restore


** panel D
preserve
collapse (mean) p_hours [pw=wp_c] if year>=2006&year<=2013, by(year treat)
twoway (scatter p_hours year if treat==1, mc(black) yaxis(1)) (scatter p_hours year if treat==0, mfc(white) mlc(black) yaxis(2)), ///
graphregion(color(white)) legend(order(1 "Over65(65-84)" 2 "Under65(45-64)")) xtitle("Year") ytitle("Hours of work per week(65-84)", axis(1)) ytitle("Hours of work per week(45-64)", axis(2)) ///
xlabel(2006(1)2013)
restore




